<?php
  header ('Content-type: text/html; charset=utf-8');
    //echo " rec db/ <br />";
 require_once 'db.php';
 //echo "rec def/ <br /> ";
 require_once 'defines.php';
 //echo "rec gb/ <br /> ";
 require_once 'gb.php';
 //echo "rec template/ <br /> ";
 require_once 'template.php';
 //echo "db_con <br /> ";
 db_connect(DBHOST, DBUSER, DBPASSWD, DBNAME) or die('dbcon'.mysql_error());
 $name=$_POST['name'];
 $message=$_POST['message'];


//Событие изменения сообщения 
 if(@$_GET['id'])
{
	$result = db_query('SELECT * FROM gb_messages WHERE id='.$_GET['id']);
    $row=db_fetch_array($result);

	$name=$row['name'];
	$message=$row['message'];
	template_changeform($_GET['id'],$name, $message);
}

//Изменение сообщения
 if(@$_GET['changeok'])
 {
gb_change($_GET['changeok'],$name, $message, &$error);
 }
 
 
//Событие изменения комментария 

 if(@$_GET['changecoment'])
 {
$result = db_query('SELECT * FROM gb_coments WHERE comentid='.$_GET['changecoment']);
    $row=db_fetch_array($result);

	$comentname=$row['comentname'];
	$coment=$row['coment'];
	template_changecomentform($_GET['changecoment'],$comentname, $coment);
 }
 
 //Изменение комментрия
 
  if(@$_GET['changecomentok'])
 {
 echo "changecoment";
gb_changecoment($_GET['changecomentok'],$name, $message, &$error);
 }
 
echo "change";
?>